package cn.jbolt.ndemo.controller;

import cn.jbolt.ndemo.entity.ComplaintPush;
import cn.jbolt.ndemo.service.ComplaintPushService;
import cn.jbolt.util.Result;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.*;

@Controller
@ResponseBody
@RequestMapping("/complaintPush")
@Tag(name = "客户投诉智能分类推送管理Controller")
public class ComplaintPushController {

    @Autowired
    private ComplaintPushService complaintPushService;

    @Operation(summary = "根据部门id,关键词查询list", description = "根据部门id,关键词查询list")
    @GetMapping("/list")
    public Result list(@RequestParam(required = false) Long deptId, @RequestParam(required = false) String keywords) {
        return complaintPushService.getList(deptId, keywords);
    }

    @Operation(summary = "新建投诉", description = "新建投诉")
    @PostMapping("/add")
    public Result add(@RequestBody ComplaintPush complaintPush) {
        return complaintPushService.add(complaintPush);
    }
    @Operation(summary = "根据部门id,分别统计部门的投诉数量", description = "根据部门id,分别统计部门的投诉数量")
    @GetMapping("/count")
    public Result count() {
        return complaintPushService.getCount();
    }
}
